package com.own.demo.lwf.utils.ownUtils;

import org.apache.commons.lang3.ArrayUtils;

import java.util.Arrays;

public class ArrayUtilsDemo {
    // 跟asList比较的好处：https://mbd.baidu.com/ug_share/mbox/4a83aa9e65/share?product=smartapp&tk=6aed408ff9681e8cbf8e84ebf7664e39&share_url=https%3A%2F%2Fyebd1h.smartapps.cn%2Fpages%2Fblog%2Findex%3FblogId%3D103527413%26_swebfr%3D1%26_swebFromHost%3Dbaiduboxapp&domain=mbd.baidu.com
    public static void main(String[] args) {
        String[] strArr = {"0","1","3","4","5","6","X","Y"};
        boolean isexistStr1 = ArrayUtils.contains(strArr,"1");
        boolean isexistStr9 = ArrayUtils.contains(strArr,"9");
        System.out.println("strArr is exist '1'"+isexistStr1);
        System.out.println("strArr is exist '9':"+isexistStr9);

        int[] intArr = {0,1,2,3,4,5};
        boolean isexistInt1 = ArrayUtils.contains(intArr,1);
        boolean isexistInt9 = ArrayUtils.contains(intArr,9);
        System.out.println("intArr is exist 1"+isexistInt1);
        System.out.println("intArr is exist 9:"+isexistInt9);


        String[] strArr1 = {"0","1","3","4","5","6","X","Y"};
        boolean isexistStr11 = Arrays.asList(strArr1).contains("1");
        boolean isexistStr99 = Arrays.asList(strArr1).contains("9");
        System.out.println("strArr is exist '1'"+isexistStr11);
        System.out.println("strArr is exist '9':"+isexistStr99);

        int[] intArr1 = {0,1,2,3,4,5};
        boolean isexistInt11 = Arrays.asList(intArr1).contains(1);
        boolean isexistInt99 = Arrays.asList(intArr1).contains(9);
        System.out.println("intArr is exist 1"+isexistInt11);
        System.out.println("intArr is exist 9:"+isexistInt99);
    }

}
